package edu.bit.water.controller;

import edu.bit.water.entity.CleanProductSub1;
import edu.bit.water.entity.MetaCleanProductSub1;
import edu.bit.water.service.TableCleanProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/table_clean_product")
public class TableCleanProductController {
    @Autowired
    private TableCleanProductService tableCleanProductService;

    @RequestMapping("/get_meta_data")
    @ResponseBody
    public List<MetaCleanProductSub1> getMetaData(String standardNumber, String page) {
        return tableCleanProductService.getMetaData(standardNumber, page);
    }

    @RequestMapping("/insert")
    @ResponseBody
    public void insert(String indicator, int lastId, String page) {
        tableCleanProductService.insert(indicator, lastId, page);
    }

    @RequestMapping("/update")
    @ResponseBody
    public void update(int id, String rank, String content, String page) {
        tableCleanProductService.update(id, rank, content, page);
    }

    @RequestMapping("/update_include_input")
    @ResponseBody
    public void updateIncludeInput(int id, String rank, String content, double input1, double input2, String page) {
        tableCleanProductService.updateIncludeInput(id, rank, content, input1, input2, page);
    }

    @RequestMapping("/select")
    @ResponseBody
    public List<CleanProductSub1> select(int lastId, String page) {
        return tableCleanProductService.select(lastId, page);
    }

    @RequestMapping("/state_update")
    @ResponseBody
    public void stateUpdate(int id, String stdState) {
        tableCleanProductService.stateUpdate(id, stdState);
    }
}
